

<?php
	include_once("dataprovider.php");
	$loai = $_POST['loai'] ;
	$i = isset($_POST['i'])?$_POST['i']:0;
	$flag = 0;
	$sql = "SELECT ma,hinh FROM sanpham where loai=$loai LIMIT $i,6";
		
	$result = DataProvider::ExecuteQuery($sql);
		
	while($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{
			$flag = 1;
?>
		<div class="item">
			<img src="<?php echo($row['hinh']);?>" alt="keke" width="202" height="173" onclick="loaddetail(<?php echo($row['ma']);?>)" /></a><br />
			<span>&nbsp;</span>
			
			<a href="#" class="buy">Mua</a>
		</div>
<?php
			
	}

	if($i!=0)
	{
?>
<br />
	<div>
		<button type="button" onclick="loadXMLDoc(<?php echo($loai);?>,<?php echo($i-6);?>)">Back</button> &nbsp;
<?php
	}
	if($flag == 1)
	{
		$i = $i + 6;
?>
		<button type="button" onclick="loadXMLDoc(<?php echo($loai);?>,<?php echo($i);?>)">Next</button>
	</div>
<?php
	}
?>


 